package com.yuanfeng.business.controller;

import com.yuanfeng.business.dto.ManageShopAddressAddDTO;
import com.yuanfeng.business.dto.ManageShopAddressDefaultUpdateDTO;
import com.yuanfeng.business.dto.ManageShopAddressDetailQueryDTO;
import com.yuanfeng.commoms.annnotation.Log;
import com.yuanfeng.commoms.dto.userms.UserTokenBeanDTO;
import com.yuanfeng.commoms.util.ResponseResult;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ShopShippingAddressController
 * @Description 商家发货地址
 * @Author cf
 * @Date 2023/6/29 15:35
 * @Version 1.0
 */
@RestController
@RequestMapping("/shop/shipping/address")
public class ShopShippingAddressController extends BaseController{


    /**
     * 店铺发货地址新增或更新
     *
     * @param param
     * @return
     */
    @Log("店铺发货地址新增或更新")
    @PostMapping("/add")
    public ResponseResult addShopAddress(@RequestBody ManageShopAddressAddDTO param) {
        return shopShippingAddressService.addShopAddress(param);
    }

    /**
     * 店铺发货地址详情删除
     *
     * @param param
     * @return
     */
    @Log("店铺发货地址详情删除")
    @PostMapping("/delete")
    public ResponseResult deleteShopAddress(@RequestBody ManageShopAddressDetailQueryDTO param) {
        return shopShippingAddressService.deleteShopAddress(param);
    }

    /**
     * 店铺发货地址详情查询
     *
     * @param param
     * @return
     */
    @PostMapping("/query/detail")
    public ResponseResult queryShopAddressDetail(@RequestBody ManageShopAddressDetailQueryDTO param) {
        return shopShippingAddressService.queryShopAddressDetail(param);
    }

    /**
     * 默认地址修改
     *
     * @param param
     * @return
     */
    @Log("默认地址修改")
    @PostMapping("/default/update")
    public ResponseResult updateShopAddressDefault(@RequestBody ManageShopAddressDefaultUpdateDTO param) {
        return shopShippingAddressService.updateShopAddressDefault(param);
    }

    /**
     * fegin 查找地址信息
     *
     * @param shippingAddressId
     * @return
     */
    @PostMapping("/queryShippingAddress")
    public ResponseResult queryShippingAddress(@RequestParam("shippingAddressId") Integer shippingAddressId) {
        return shopShippingAddressService.queryShippingAddress(shippingAddressId);
    }

    /**
     * 平台查询积分商品发货地址
     *
     * @param param
     * @return
     */
    @PostMapping("/get")
    public ResponseResult selectAddress(@RequestBody UserTokenBeanDTO param) {
        ResponseResult result=shopShippingAddressService.selectAddress(param);
        return result;
    }

    /**
     * 店铺发货地址列表查询
     *
     * @param param
     * @return
     */
    @PostMapping("/query/list")
    public ResponseResult queryShopAddressList(@RequestBody UserTokenBeanDTO param) {
        return shopShippingAddressService.queryShopAddressList(param);
    }
}
